package xin.sunzy.ssms.dao.impl;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import xin.sunzy.ssms.dao.intf.IUserDao;
import xin.sunzy.ssms.entity.po.User;

/**
 * Created by 17070725 on 2017/8/13.
 */

@Repository("userDao")
public class UserDao implements IUserDao {

    @Autowired
    private SqlSession sqlSession;

    @Override
    public User getUserByUsername(@Param(value="username") String username) throws Exception {
        try {
            return sqlSession.selectOne("xin.sunzy.ssms.dao.intf.IUserDao.getUserByUsername",username);
        }catch (Exception e){
            throw new Exception("UserDao.getUserByUsername:操作数据库异常",e);
        }
    }
}
